//
//  teyuebaoxiuViewController.m
//  wuyeviewcon
//
//  Created by dsdf on 16/1/26.
//  Copyright © 2016年 joey. All rights reserved.
//

#import "teyuebaoxiuViewController.h"
#import "baoxiuxiangqingViewController.h"
#import "baoxiuleixinggViewController.h"

@interface teyuebaoxiuViewController ()

@end

@implementation teyuebaoxiuViewController




-(void)OnTouchViewHideKeyBoard{
    [self.view endEditing:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    
    UIButton *button=[[UIButton alloc]init];
    button.frame=CGRectMake(0, 0, 375, 64);
    button.backgroundColor=[UIColor colorWithRed: 230/255.0 green:55/255.0 blue:55/255.0 alpha:1.0];
    [self.view addSubview:button];
    
    
    
    
    UIButton *button1=[[UIButton alloc]init ];//]WithFrame:CGRectMake(50, 50, 20, 20)];
    button1.frame=CGRectMake(22, 35, 20, 20);
    [button1 setBackgroundImage:[UIImage imageNamed:@"return@2x.png"] forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(fanhui:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button1];
    
    
    //self.navigationItem

    
    NSArray *arry=[[NSArray alloc]initWithObjects:@"特约报修",@"我的报修", nil];
    UISegmentedControl *sege=[[UISegmentedControl alloc]initWithItems:arry];
    sege.frame=CGRectMake(102, 29, 185, 27);
    sege.selectedSegmentIndex=0;
    sege.tintColor=[UIColor whiteColor];
    sege.backgroundColor=[UIColor redColor];
    //sege.momentary=YES;
    sege.segmentedControlStyle=UISearchBarStyleDefault;
    sege.layer.masksToBounds=YES;
    //[sege addTarget:selfaction:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
    [sege addTarget:self action:@selector(controlPressed:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:sege];
    _baoxiuleixingview.alpha=1;
    _wodebaoxiu.alpha=0;
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



- (IBAction)fanhui:(id)sender {
    [self dismissModalViewControllerAnimated:YES];
}



- (IBAction)baoxiuleixingbut:(id)sender {

    NSLog(@"报修类型");
    //baoxiuleixingViewController *demoVC=[[baoxiuleixingViewController alloc]init];
    //[self presentViewController:demoVC animated:YES completion:NULL];
    
   // [self.navigationController pushViewController:demoVC animated:YES];
    //[self.modalViewController ]
    baoxiuleixinggViewController *demoVC=[[baoxiuleixinggViewController alloc]init];
    [demoVC setHidesBottomBarWhenPushed:YES];
    [self presentViewController:demoVC animated:YES completion:NULL];
    
    
}
- (IBAction)baoxiuxiangqing:(id)sender {
    
    NSLog(@"特约报修详情");
    baoxiuxiangqingViewController *demoVC=[[baoxiuxiangqingViewController alloc]init];
    [demoVC setHidesBottomBarWhenPushed:YES];
    [self presentViewController:demoVC animated:YES completion:NULL];
    
    
    
}


-(void)controlPressed:(id)sender{
    
    
    
    UISegmentedControl *control = (UISegmentedControl *)sender;
    
    
    
    int x = control.selectedSegmentIndex;
    
    switch (x) {
        case 0:
            NSLog(@"1");
            _baoxiuleixingview.alpha=1;
            _wodebaoxiu.alpha=0;
            
            break;
            
        default:
            NSLog(@"2");
            _baoxiuleixingview.alpha=0;
            _wodebaoxiu.alpha=1;
            
            break;
    }
    
    
    
}





/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
